using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Hyperbolic;
using Microsoft.Win32;
using Hyperbolic.Model;


namespace HyperbolicTest
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>

    public partial class Window1 : System.Windows.Window
    {
        public Window1()
        {
            InitializeComponent();

            RegistryNode __root = new RegistryNode(Registry.LocalMachine, 0);
            TreeModel __model = new TreeModel(__root);
            this.htree.Attach(__model);

            //this for debug purpose
            this.grid3.DataContext = __model;

        }

        private void TreeItemDoubleClick(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement fe = e.OriginalSource as FrameworkElement;
            if (fe != null)
            {
                NodeModel keyHolder = fe.DataContext as NodeModel;
                if (keyHolder != null)
                {
                    keyHolder.IsExpanded = !keyHolder.IsExpanded;
                    e.Handled = true;
                }
            }
        }


        

    }

}
